package scu.maqiang.numeric;

/**
 * 
 * @author Administrator
 *
 * @param <T1>
 * @param <T2>
 */
public class Pair<T1, T2> {
	public T1 first;
	public T2 second;
	public Pair() {}
	public Pair(T1 first, T2 second) {
		this.first = first;
		this.second = second;
	}
	
	public T1 getFirst() {
		return first;
	}
	
	public T2 getSecond() {
		return second;
	}
	
	public void setFirst(T1 first) {
		this.first = first;
	}
	
	public void setSecond(T2 second) {
		this.second = second;
	}
	
	public static double[] getFirst(Pair<Double, double[]>[] array) {
		int n = array.length;
		double[] result = new double[n];
		for(int i = 0; i < n; i++) {
			result[i] = array[i].first;
		}
		return result;
	}

	public static double[][] getSecond(Pair<Double, double[]>[] array) {
		int n = array.length;
		double[][] result = new double[n][];
		for(int i = 0; i < n; i++) {
			result[i] = array[i].second;
		}
		return result;		
	}
}
